package com.firmail.utils;

import com.firmail.model.ResultObject;

public class ResultUtil {

    public static  <T> ResultObject ok(T obj){
        ResultObject<T> result= new ResultObject<>();
        result.setCode(0);
        result.setData(obj);
        result.setMessage("Execute successfully.");
        return  result;

    }

    public static  <T> ResultObject ok(){
        return ok(null);
    }

    public static  <T> ResultObject error(int code, String errorMsg){
        ResultObject<T> result= new ResultObject<>();
        result.setCode(code);

        result.setMessage(errorMsg);
        return  result;

    }

}
